package com.itheima_6;

import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class ConcurrentHashMapDemo {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<Integer,Integer> chm= new ConcurrentHashMap<>();
            Thread t1=new Thread(()->{
                for (int i = 0; i < 25; i++) {
                    chm.put(i,i);
                }
            });
            Thread t2=new Thread(()->{
                for (int i = 25; i < 51; i++) {
                    chm.put(i,i);
                }
            });
            t1.start();
            t2.start();
            //Thread.sleep(1000);
        for (int i = 0; i < 51; i++) {
            System.out.println(chm.get(i));
        }
    }
}
